#include "Translator.h"

Translator::Translator(QString languageFileName)
{
    this->languageFileName = new QString(languageFileName);
    QFile file(*this->languageFileName);
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
	     return;


}

void Translator::configFileParse()
{
    QTextStream inputStream(&file);
    *this->languageFile = inputStream.readAll();

    /*
    QChar symbol;
    for(unsigned int i=0; i<languageFile->size(); i++)
    {
        symbol = languageFile->at(i);
        switch(symbol)
        {
            case "\n":
                continue;
            case " ":
                continue;
            case "/":
            {
                i++;
                if(languageFile->at(i) == "/")
                    i = languageFile->indexOf("\n", i);
                else if(languageFile->at(i) == "*")
                {
                    i = languageFile->indexOf("", i);
                    i++;
                }
            }
            default:
        }
    */
    unsigned int i = 0;
    while(i<languageFile->size())
    {
        if(languageFile->at(i) == "/" and languageFile->at(i+1) == "/")
            languageFile->remove(i, languageFile->indexOf("\n", i) - i);
        else
            i=languageFile->indexOf("\n", i)+1;
    }
    i = 0;

    i=languageFile->indexOf("<Language>", i) + 9;

}
